let { resolveApp, appLib } = require('./paths');
const TerserWebpackPlugin = require('terser-webpack-plugin');
module.exports = {
    mode: 'none',
    entry: {
        'add-number': resolveApp('src/lib/index.js'),
        'add-number.min': resolveApp('src/lib/index.js')
    },
    output: {
        filename: '[name].js',
        library: {
            name: 'MyLib',
            type: 'umd'
        },
        // 旧的配置方式
        // library: 'MyLib',
        // libraryTarget: 'umd',

        libraryExport: 'default',
        path: appLib,
        clean: true
    },
    optimization: {
        minimize: true,
        minimizer: [
            new TerserWebpackPlugin({
                test: /\.min\.js$/,
                extractComments: false // 不抽取注释
            })
        ]
    }
};
